<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GridLAB-D&trade; - GUI Example 4</title>
</head>
<body onload="load();">
<script type="text/javascript" src="/rt/gridlabd.js" ></script>
<table>
<tr><td>Test of</td><td><div id="nhouses"> &ndash; </div></td><td>houses</td></tr>
</table>

<table>
<tr><th>Average floorarea</th><td><input id="avg" value="" onfocus="enable('avg');" /><input type="submit" name="avg_ok" value="&radic;" disabled="disabled" onclick="save('avg','AVG_SF');" /><input type="submit" name="avg_undo" value="X" disabled="disabled" onclick="reset('avg','AVG_SF');" /><input type="submit" name="avg_undo" value="?" onclick="help('avg');" /></td></tr>
<tr><th>Floorarea stdev</th><td><input id="std" value="" onfocus="enable('std');" /><input type="submit" name="std_ok" value="&radic;" disabled="disabled" onclick="save('std','STD_SF');" /><input type="submit" name="std_undo" value="X" disabled="disabled" onclick="reset('std','STD_SF');" /><input type="submit" name="std_undo" value="?" onclick="help('std');" /></td></tr>
<tr><th>Start date/time</th><td><input id="clock" value="" onfocus="enable('clock');" /><input type="submit" name="clock_ok" value="&radic;" disabled="disabled" onclick="save('clock','STD_SF');" /><input type="submit" name="clock_undo" value="X" disabled="disabled" onclick="reset('clock','STD_SF');" /><input type="submit" name="clock_undo" value="?" onclick="help('clock');" /></td></tr>
</table>

<script type="text/javascript">

function save(name,variable)
{
    GLDSetGlobal(variable,document.getElementById(name).value);
    disable(name);
}
function reset(name,variable)
{
    document.getElementById(name).value = GLDGetGlobal(variable);
    disable(name);
}
function enable(name)
{
    document.getElementById(name+"_ok").disabled = false;
    document.getElementById(name+"_undo").disabled = false;
}
function disable(name)
{
    document.getElementById(name+"_ok").disabled = true;
    document.getElementById(name+"_undo").disabled = true;
}
function load()
{
    document.getElementById("nhouses").innerHTML = nhouses;

    document.getElementById("avg").value = GLDGetGlobal("AVG_SF");
    document.getElementById("std").value = GLDGetGlobal("STD_SF");
    document.getElementById("clock").value = GLDGetGlobal("clock");
}

</script>

<img id="graph1" src="/gnuplot/data.plt?image/png" height="300" width="500" />

<input type="submit" value="Continue" onclick="GLDAction('continue');" />
<input type="submit" value="Quit" onclick="window.close();" />

</body>
</html>